/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author N
 */
@Entity
@Table(name = "contrat_auto")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ContratAuto.findAll", query = "SELECT c FROM ContratAuto c"),
    @NamedQuery(name = "ContratAuto.findByModele", query = "SELECT c FROM ContratAuto c WHERE c.modele = :modele"),
    @NamedQuery(name = "ContratAuto.findByCategorieAuto", query = "SELECT c FROM ContratAuto c WHERE c.categorieAuto = :categorieAuto"),
    @NamedQuery(name = "ContratAuto.findByNumContratAuto", query = "SELECT c FROM ContratAuto c WHERE c.numContratAuto = :numContratAuto"),
    @NamedQuery(name = "ContratAuto.findByPrixAuto", query = "SELECT c FROM ContratAuto c WHERE c.prixAuto = :prixAuto"),
    @NamedQuery(name = "ContratAuto.findByBrisGlace", query = "SELECT c FROM ContratAuto c WHERE c.brisGlace = :brisGlace"),
    @NamedQuery(name = "ContratAuto.findByVol", query = "SELECT c FROM ContratAuto c WHERE c.vol = :vol"),
    @NamedQuery(name = "ContratAuto.findByTiers", query = "SELECT c FROM ContratAuto c WHERE c.tiers = :tiers"),
    @NamedQuery(name = "ContratAuto.findByToutRisque", query = "SELECT c FROM ContratAuto c WHERE c.toutRisque = :toutRisque"),
    @NamedQuery(name = "ContratAuto.findByFranchise", query = "SELECT c FROM ContratAuto c WHERE c.franchise = :franchise"),
    @NamedQuery(name = "ContratAuto.findByStatut", query = "SELECT c FROM ContratAuto c WHERE c.statut = :statut"),
    @NamedQuery(name = "ContratAuto.findByNumeroClient", query = "SELECT c FROM ContratAuto c WHERE c.numeroClient = :numeroClient"),
    @NamedQuery(name = "ContratAuto.findByImmatriculation", query = "SELECT c FROM ContratAuto c WHERE c.immatriculation = :immatriculation")})
public class ContratAuto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Size(max = 40)
    @Column(name = "modele")
    private String modele;
    @Column(name = "categorie_auto")
    private Integer categorieAuto;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "num_contrat_auto")
    private Integer numContratAuto;
    @Column(name = "prix_auto")
    private Integer prixAuto;
    @Column(name = "bris_glace")
    private Boolean brisGlace;
    @Column(name = "vol")
    private Boolean vol;
    @Column(name = "tiers")
    private Boolean tiers;
    @Column(name = "tout_risque")
    private Boolean toutRisque;
    @Column(name = "franchise")
    private Integer franchise;
    @Size(max = 30)
    @Column(name = "statut")
    private String statut;
    @Basic(optional = false)
    @NotNull
    @Column(name = "numero_client")
    private int numeroClient;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "immatriculation")
    private String immatriculation;

    public ContratAuto() {
    }

    public ContratAuto(Integer numContratAuto) {
        this.numContratAuto = numContratAuto;
    }

    public ContratAuto(Integer numContratAuto, int numeroClient, String immatriculation) {
        this.numContratAuto = numContratAuto;
        this.numeroClient = numeroClient;
        this.immatriculation = immatriculation;
    }

    public ContratAuto(String immatriculation, String modele, int categorie,
            int prix, boolean bris, boolean vol, boolean toutRisque, int franchise, int numeroClient){
        this.immatriculation = immatriculation;
        this.modele = modele;
        this.categorieAuto = categorie;
        this.prixAuto = prix;
        this.tiers = true;
        this.brisGlace = bris;
        this.vol = vol;
        this.toutRisque = toutRisque;
        this.franchise = franchise;
        this.numeroClient = numeroClient;
        this.statut = "aValider";
    }
    
    public String getModele() {
        return modele;
    }

    public void setModele(String modele) {
        this.modele = modele;
    }

    public Integer getCategorieAuto() {
        return categorieAuto;
    }

    public void setCategorieAuto(Integer categorieAuto) {
        this.categorieAuto = categorieAuto;
    }

    public Integer getNumContratAuto() {
        return numContratAuto;
    }

    public void setNumContratAuto(Integer numContratAuto) {
        this.numContratAuto = numContratAuto;
    }

    public Integer getPrixAuto() {
        return prixAuto;
    }

    public void setPrixAuto(Integer prixAuto) {
        this.prixAuto = prixAuto;
    }

    public Boolean getBrisGlace() {
        return brisGlace;
    }

    public void setBrisGlace(Boolean brisGlace) {
        this.brisGlace = brisGlace;
    }

    public Boolean getVol() {
        return vol;
    }

    public void setVol(Boolean vol) {
        this.vol = vol;
    }

    public Boolean getTiers() {
        return tiers;
    }

    public void setTiers(Boolean tiers) {
        this.tiers = tiers;
    }

    public Boolean getToutRisque() {
        return toutRisque;
    }

    public void setToutRisque(Boolean toutRisque) {
        this.toutRisque = toutRisque;
    }

    public Integer getFranchise() {
        return franchise;
    }

    public void setFranchise(Integer franchise) {
        this.franchise = franchise;
    }

    public String getStatut() {
        return statut;
    }

    public void setStatut(String statut) {
        this.statut = statut;
    }

    public int getNumeroClient() {
        return numeroClient;
    }

    public void setNumeroClient(int numeroClient) {
        this.numeroClient = numeroClient;
    }

    public String getImmatriculation() {
        return immatriculation;
    }

    public void setImmatriculation(String immatriculation) {
        this.immatriculation = immatriculation;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numContratAuto != null ? numContratAuto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ContratAuto)) {
            return false;
        }
        ContratAuto other = (ContratAuto) object;
        if ((this.numContratAuto == null && other.numContratAuto != null) || (this.numContratAuto != null && !this.numContratAuto.equals(other.numContratAuto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.ContratAuto[ numContratAuto=" + numContratAuto + " ]";
    }
    
}
